Repository navigation
fix(@angular/build): avoid expanding directory patterns in asset globs - #34494
Merged
alan-agius4 merged 2 commits intoOct 22, 2026
Merged
Conversation
Previously, when an asset entry specified a directory pattern in `glob` (such as `glob: 'sub/'` or `glob: 'sub'`), its behavior differed depending on whether `ignore` was present: without `ignore`, the static single-file fast-path returned no files, whereas with `ignore`, `tinyglobby` ran with its default `expandDirectories: true` option and recursively matched all files in the directory. This change disables `expandDirectories` for `glob` in `resolveAssets` while preserving directory expansion for `ignore` patterns via a shared `normalizeAssetIgnorePatterns` helper.
There was a problem hiding this comment.
Code Review
This pull request refactors asset resolution and ignore pattern normalization in the Angular build pipeline. It introduces 'normalizeAssetIgnorePatterns' to handle directory-exclusion semantics consistently, ensuring that directory patterns exclude all nested files, and updates the asset matcher and resolver to handle trailing slashes and prevent directory pattern expansion in globs. The review feedback recommends returning a shallow copy of the default ignore patterns array in 'normalizeAssetIgnorePatterns' to prevent potential side-effects from array mutation.
clydin
approved these changes
Oct 22, 2026
Collaborator
Author
|
This PR was merged into the repository. The changes were merged into the following branches:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, when an asset entry specified a directory pattern in
glob(such asglob: 'sub/'orglob: 'sub'), its behavior differed depending on whetherignorewas present:ignore, the static single-file fast-path checkedstats.isFile()and returned no files.ignore,tinyglobbyran with its defaultexpandDirectories: trueoption and recursively matched all files in the directory.This change disables
expandDirectoriesforglobinresolveAssetswhile preserving directory expansion forignorepatterns via a sharednormalizeAssetIgnorePatternshelper.